package com.nfdw.project.service.impl;

import com.nfdw.project.core.AbstractService;
import com.nfdw.project.dao.WholesaleUserTradeSettleInfoMapper;
import com.nfdw.project.dto.WholesaleUserTradeSettleInfoDto;
import com.nfdw.project.model.WholesaleUserTradeSettleInfo;
import com.nfdw.project.service.WholesaleUserTradeSettleInfoService;
import com.nfdw.project.vo.RetailUserTradeSettleInfoVo;
import com.nfdw.project.vo.RetailUserTradeSettleTotalInfoVo;
import com.nfdw.project.vo.WholesaleUserTradeSettleInfoVo;
import com.nfdw.project.vo.WholesaleUserTradeSettleTotalInfoVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Optional;

@Service
@Transactional
public class WholesaleUserTradeSettleInfoServiceImpl extends AbstractService<WholesaleUserTradeSettleInfo> implements WholesaleUserTradeSettleInfoService {

    @Resource
    private WholesaleUserTradeSettleInfoMapper wholesaleUserTradeSettleInfoMapper;

    @Override
    public WholesaleUserTradeSettleTotalInfoVo tradeSettleInfo(WholesaleUserTradeSettleInfoDto param) {
        WholesaleUserTradeSettleTotalInfoVo wholesaleUserTradeSettleTotalInfoVo = wholesaleUserTradeSettleInfoMapper.tradeSettleInfo(param);
        Optional<WholesaleUserTradeSettleTotalInfoVo> entity = Optional.ofNullable(wholesaleUserTradeSettleTotalInfoVo);
        return entity.orElse(new WholesaleUserTradeSettleTotalInfoVo());
    }

    @Override
    public List<WholesaleUserTradeSettleInfoVo> tradeSettleAnalysis(WholesaleUserTradeSettleInfoDto param) {

        return wholesaleUserTradeSettleInfoMapper.tradeSettleAnalysis(param);
    }


}
